Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DUBBO-3746] Bugfix: infinite loop in AbstractRegistry when IOException. fix #3746 #3748

Merged
merged 3 commits into from
Apr 17, 2019
Merged

[DUBBO-3746] Bugfix: infinite loop in AbstractRegistry when IOException. fix #3746 #3748

merged 3 commits into from
Apr 17, 2019

Conversation

kezhenxu94
Copy link
Member

What is the purpose of the change

resolve #3746

When IOException is thrown in org.apache.dubbo.registry.support.AbstractRegistry#doSaveProperties, which is usually unrecoverable (permission denied, path not exists or no free disk space) it will retry infinitely, this patch tries to resolve this issue by stop retrying when IOException occurs.

Brief changelog

org.apache.dubbo.registry.support.AbstractRegistry

Verifying this change

XXXXX

Follow this checklist to help us incorporate your contribution quickly and easily:

  • Make sure there is a GITHUB_issue field for the change (usually before you start working on it). Trivial changes like typos do not require a GITHUB issue. Your pull request should address just this issue, without pulling in other changes - one PR resolves one issue.
  • Format the pull request title like [Dubbo-XXX] Fix UnknownException when host config not exist #XXX. Each commit in the pull request should have a meaningful subject line and body.
  • Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
  • Write necessary unit-test to verify your logic correction, more mock a little better when cross module dependency exist. If the new feature or significant change is committed, please remember to add integration-test in test module.
  • Run mvn clean install -DskipTests=false & mvn clean test-compile failsafe:integration-test to make sure unit-test and integration-test pass.
  • If this contribution is large, please follow the Software Donation Guide.

@codecov-io
Copy link

codecov-io commented Mar 27, 2019

Codecov Report

Merging #3748 into master will increase coverage by 0.05%.
The diff coverage is 87.5%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master    #3748      +/-   ##
============================================
+ Coverage     63.55%   63.61%   +0.05%     
  Complexity       71       71              
============================================
  Files           704      704              
  Lines         31069    31070       +1     
  Branches       5037     5038       +1     
============================================
+ Hits          19746    19765      +19     
+ Misses         9050     9034      -16     
+ Partials       2273     2271       -2
Impacted Files Coverage Δ Complexity Δ
...pache/dubbo/registry/support/AbstractRegistry.java 80.84% <87.5%> (+0.13%) 0 <0> (ø) ⬇️
...e/dubbo/remoting/transport/netty/NettyChannel.java 57.64% <0%> (-4.71%) 0% <0%> (ø)
...he/dubbo/qos/server/handler/QosProcessHandler.java 55.88% <0%> (-1.27%) 0% <0%> (ø)
.../exchange/support/header/HeaderExchangeServer.java 66.98% <0%> (-0.95%) 0% <0%> (ø)
...ting/exchange/support/header/HeartbeatHandler.java 83.72% <0%> (-0.73%) 0% <0%> (ø)
...exchange/support/header/HeaderExchangeHandler.java 62.2% <0%> (-0.59%) 0% <0%> (ø)
...rpc/cluster/loadbalance/RoundRobinLoadBalance.java 79.68% <0%> (-0.32%) 0% <0%> (ø)
...cluster/loadbalance/ConsistentHashLoadBalance.java 87.75% <0%> (ø) 0% <0%> (ø) ⬇️
...c/main/java/org/apache/dubbo/common/Constants.java 93.33% <0%> (ø) 0% <0%> (ø) ⬇️
...dubbo/rpc/protocol/dubbo/CallbackServiceCodec.java 80.88% <0%> (+0.73%) 0% <0%> (ø) ⬇️
... and 5 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c11df93...b4310a9. Read the comment docs.

@kezhenxu94 kezhenxu94 changed the title [DUBBO-3746] Bugfix: dead loop in AbstractRegistry when IOException. fix #3746 [DUBBO-3746] Bugfix: infinite loop in AbstractRegistry when IOException. fix #3746 Mar 27, 2019
@ralf0131
Copy link
Contributor

What if other type of exception other than IOException is thrown, this might introduce the same issue. I think a safer way is to limit the number of time to retry.

@kezhenxu94
Copy link
Member Author

What if other type of exception other than IOException is thrown, this might introduce the same issue. I think a safer way is to limit the number of time to retry.

@ralf0131 how many times to retry? I think 3 is enough, what's your opinion?

@ralf0131
Copy link
Contributor

What if other type of exception other than IOException is thrown, this might introduce the same issue. I think a safer way is to limit the number of time to retry.

@ralf0131 how many times to retry? I think 3 is enough, what's your opinion?

3 looks good to me.

Copy link
Contributor

@ralf0131 ralf0131 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code looks good to me. I'd waiting for @carryxyh 's comments.

@ralf0131
Copy link
Contributor

Ping @carryxyh , what's your opinion on this pull request?

@carryxyh
Copy link
Member

Sorry for coming late. @kezhenxu94 @ralf0131

I have no more comments on this pr. After my test, multiple threads read and write to the same file will not generate exceptions and will not be out of order. But we still have to consider some other special circumstances that cause the write to fail.

I think we can merge this pr first, I will conduct further testing and submit an extra pr if I think we need to optimize it.

@carryxyh
Copy link
Member

@kezhenxu94
Pls help to check if org.apache.dubbo.metadata.support.AbstractMetadataReport#doSaveProperties has the same problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants